import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import cesium from "vite-plugin-cesium";
const cesiumSource = "node_modules/cesium/Build/Cesium";
const cesiumBaseUrl = "Cesium";

// https://vite.dev/config/
export default defineConfig({
  base: "./",
  // define: {
  //   CESIUM_BASE_URL: JSON.stringify(`/${cesiumBaseUrl}`),
  // },
  plugins: [vue(), cesium()],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
  server: {
    proxy: {
      "/geoserver": {
        target: "http://106.52.5.98:3000/",
        changeOrigin: true,
        // rewrite: (path) => path.replace(/^\/ceshi/, ""),
      },
      "/model": {
        target: "http://106.52.5.98/cesium/",
        changeOrigin: true,
        // rewrite: (path) => path.replace(/^\/ceshi/, ""),
      },
    },
  },
});
